package com.flower.salary.common.utils;

import com.flower.salary.domain.entity.SysUser;

/**
 * @author lavender
 * @version 1.0
 * @date 2024-02-27 21:17
 */
public class LocalUser {
    private static ThreadLocal<SysUser> local = new ThreadLocal<>();
    public static SysUser getLocalUser() {

        return LocalUser.local.get();
    }

    public static void setLocalUser(SysUser user) {
        LocalUser.local.set(user);
    }

    public static <T> T getLocalUser(Class<T> clazz) {
        return (T) local.get();
    }

    public static void clearLocalUser() {
        LocalUser.local.remove();
    }


}
